package gestionColis;

/**
 * Interface definition : GestTransporteur
 * 
 * @author OpenORB Compiler
 */
public class _GestTransporteurStub extends org.omg.CORBA.portable.ObjectImpl
        implements GestTransporteur
{
    static final String[] _ids_list =
    {
        "IDL:gestionColis/GestTransporteur:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = gestionColis.GestTransporteurOperations.class;

    /**
     * Operation enregistrerTransporteur
     */
    public void enregistrerTransporteur(gestionColis.Transporteur transporteur)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("enregistrerTransporteur",true);
                    gestionColis.TransporteurHelper.write(_output,transporteur);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("enregistrerTransporteur",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    _self.enregistrerTransporteur( transporteur);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation verifieIdentiteTransporteur
     */
    public void verifieIdentiteTransporteur(gestionColis.InfoColis colis)
        throws gestionColis.IdTransporteurInvalideException, gestionColis.NumColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("verifieIdentiteTransporteur",true);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.IdTransporteurInvalideExceptionHelper.id()))
                    {
                        throw gestionColis.IdTransporteurInvalideExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(gestionColis.NumColisInexistantExceptionHelper.id()))
                    {
                        throw gestionColis.NumColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("verifieIdentiteTransporteur",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    _self.verifieIdentiteTransporteur( colis);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation majEtatColis
     */
    public void majEtatColis(gestionColis.InfoColis colis)
        throws gestionColis.IdTransporteurInvalideException, gestionColis.NumColisInexistantException, gestionColis.EtatIncorrectException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("majEtatColis",true);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.IdTransporteurInvalideExceptionHelper.id()))
                    {
                        throw gestionColis.IdTransporteurInvalideExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(gestionColis.NumColisInexistantExceptionHelper.id()))
                    {
                        throw gestionColis.NumColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(gestionColis.EtatIncorrectExceptionHelper.id()))
                    {
                        throw gestionColis.EtatIncorrectExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("majEtatColis",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    _self.majEtatColis( colis);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation consulterEtatColis
     */
    public gestionColis.InfoColis consulterEtatColis(gestionColis.InfoColis colis)
        throws gestionColis.NumColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("consulterEtatColis",true);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    gestionColis.InfoColis _arg_ret = gestionColis.InfoColisHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.NumColisInexistantExceptionHelper.id()))
                    {
                        throw gestionColis.NumColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("consulterEtatColis",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    return _self.consulterEtatColis( colis);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation validerTransporteur
     */
    public String validerTransporteur(gestionColis.InfoColis colis)
        throws gestionColis.NumColisInexistantException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("validerTransporteur",true);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    String _arg_ret = _input.read_string();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.NumColisInexistantExceptionHelper.id()))
                    {
                        throw gestionColis.NumColisInexistantExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("validerTransporteur",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    return _self.validerTransporteur( colis);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation mandaterTransporteur
     */
    public void mandaterTransporteur(gestionColis.InfoColis colis)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("mandaterTransporteur",false);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("mandaterTransporteur",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    _self.mandaterTransporteur( colis);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation verifieValiditeCodePresta
     */
    public boolean verifieValiditeCodePresta(String idTransporteur, String codePresta)
        throws gestionColis.CodePrestationInvalideException, gestionColis.CodePrestationPerimeException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("verifieValiditeCodePresta",true);
                    _output.write_string(idTransporteur);
                    _output.write_string(codePresta);
                    _input = this._invoke(_output);
                    boolean _arg_ret = _input.read_boolean();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.CodePrestationInvalideExceptionHelper.id()))
                    {
                        throw gestionColis.CodePrestationInvalideExceptionHelper.read(_exception.getInputStream());
                    }

                    if (_exception_id.equals(gestionColis.CodePrestationPerimeExceptionHelper.id()))
                    {
                        throw gestionColis.CodePrestationPerimeExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("verifieValiditeCodePresta",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestTransporteurOperations _self = (gestionColis.GestTransporteurOperations) _so.servant;
                try
                {
                    return _self.verifieValiditeCodePresta( idTransporteur,  codePresta);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
